;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.7.1 #0 (MSVC)
;--------------------------------------------------------
; NY8A port
;--------------------------------------------------------
	.file	"isr.c"
	list	p=NY8B062E,c=on
	#include "ny8b062e.inc"
	.debuginfo language C89
;--------------------------------------------------------
; external declarations
;--------------------------------------------------------
	extern	_sinf
	extern	_cosf
	extern	_tanf
	extern	_cotf
	extern	_asinf
	extern	_acosf
	extern	_atanf
	extern	_atan2f
	extern	_sinhf
	extern	_coshf
	extern	_tanhf
	extern	_expf
	extern	_logf
	extern	_log10f
	extern	_powf
	extern	_sqrtf
	extern	_fabsf
	extern	_frexpf
	extern	_ldexpf
	extern	_ceilf
	extern	_floorf
	extern	_modff
	extern	_isnan
	extern	_isinf
	extern	_multi_16b
	extern	_read_14bit_rom
	extern	_Adc_Start
	extern	_Adc_SetVref
	extern	_Adc_GetOnce
	extern	_Mcu_Delayus
	extern	_Mcu_Delayms
	extern	_CapSS_Init
	extern	_CapSS_GetValue
	extern	_TouchKey_Init
	extern	_TouchKey_Scan
	extern	_Btn_Loop
	extern	_Btn_Init
	extern	_SoftCT_EvIOInt
	extern	_SoftCT_EvTimeout
	extern	_SoftCT_GetEvent
	extern	_SoftCT_Run
	extern	_SoftCT_Stop
	extern	_PORTAbits
	extern	_PORTBbits
	extern	_PCONbits
	extern	_BWUCONbits
	extern	_ABPLCONbits
	extern	_BPHCONbits
	extern	_INTEbits
	extern	_INTFbits
	extern	_ADMDbits
	extern	_ADRbits
	extern	_ADVREFHbits
	extern	_ADCRbits
	extern	_AWUCONbits
	extern	_PACONbits
	extern	_ADJMDbits
	extern	_INTEDGbits
	extern	_ANAENbits
	extern	_RFCbits
	extern	_INTE2bits
	extern	__Adc_mDiscard
	extern	__Polsys_mTicked
	extern	_TouchKey_mKeyStatus
	extern	__Btn_mIsDown
	extern	_SoftCT_mCaptureValue
	extern	_INDF
	extern	_TMR0
	extern	_PCL
	extern	_STATUS
	extern	_FSR
	extern	_PORTA
	extern	_PORTB
	extern	_PCON
	extern	_BWUCON
	extern	_PCHBUF
	extern	_ABPLCON
	extern	_BPHCON
	extern	_INTE
	extern	_INTF
	extern	_ADMD
	extern	_ADR
	extern	_ADD
	extern	_ADVREFH
	extern	_ADCR
	extern	_AWUCON
	extern	_PACON
	extern	_ADJMD
	extern	_INTEDG
	extern	_TMRH
	extern	_ANAEN
	extern	_RFC
	extern	_TM3RH
	extern	_INTE2
	extern	_TMR1
	extern	_T1CR1
	extern	_T1CR2
	extern	_PWM1DUTY
	extern	_PS1CV
	extern	_BZ1CR
	extern	_IRCR
	extern	_TBHP
	extern	_TBHD
	extern	_TMR2
	extern	_T2CR1
	extern	_T2CR2
	extern	_PWM2DUTY
	extern	_PS2CV
	extern	_BZ2CR
	extern	_OSCCR
	extern	_TMR3
	extern	_T3CR1
	extern	_T3CR2
	extern	_PWM3DUTY
	extern	_PS3CV
	extern	_BZ3CR
	extern	_P4CR1
	extern	_PWM4DUTY
	extern	_IOSTA
	extern	_IOSTB
	extern	_APHCON
	extern	_PS0CV
	extern	_BODCON
	extern	_CMPCR
	extern	_PCON1
	extern	_T0MD
	extern	___sdcc_saved_fsr
	extern	___sdcc_saved_stk00
	extern	___sdcc_saved_stk01

	extern PSAVE
	extern SSAVE
	extern WSAVE
	extern STK04
	extern STK03
	extern STK02
	extern STK01
	extern STK00
;--------------------------------------------------------
; global declarations
;--------------------------------------------------------
	extern	_isr_hw

;--------------------------------------------------------
; global definitions
;--------------------------------------------------------
;--------------------------------------------------------
; absolute symbol definitions
;--------------------------------------------------------
;--------------------------------------------------------
; compiler-defined variables
;--------------------------------------------------------
;--------------------------------------------------------
; initialized data
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
;	udata_ovr
;--------------------------------------------------------
; interrupt and initialization code
;--------------------------------------------------------
ORG 0x0008
	MGOTO	__sdcc_interrupt

.segment "code"
__sdcc_interrupt:
;***
;  pBlock Stats: dbName = I
;***
;functions called:
;   _SoftCT_EvIOInt
;   _SoftCT_EvTimeout
;   _SoftCT_EvIOInt
;   _SoftCT_EvTimeout
;2 compiler assigned registers:
;   STK00
;   STK01
;; Starting pCode block
_isr_hw:
; 0 exit points
	.line	5, "isr.c"; 	void isr_hw(void) __interrupt(0)
	MOVAR	WSAVE
	SWAPR	STATUS,W
	CLRR	STATUS
	MOVAR	SSAVE
	MOVR	PCHBUF,W
	CLRR	PCHBUF
	MOVAR	PSAVE
	MOVR	FSR,W
	BANKSEL	___sdcc_saved_fsr
	MOVAR	___sdcc_saved_fsr
	MOVR	STK00,W
	BANKSEL	___sdcc_saved_stk00
	MOVAR	___sdcc_saved_stk00
	MOVR	STK01,W
	BANKSEL	___sdcc_saved_stk01
	MOVAR	___sdcc_saved_stk01
	.line	11, "isr.c"; 	if (INT0IF)//(INT0IE && INT0IF)  // PB0管脚的 INT0 中断只会在电容采样时开启，一旦发生，说明正在电容采样
	BANKSEL	_INTF
	BTRSS	_INTF,2
	MGOTO	_00106_DS_
	.line	13, "isr.c"; 	SoftCT_EvIOInt();  // 调用此函数通知 SoftCT 捕获到了跳变，这里不判断是什么跳变。
	MCALL	_SoftCT_EvIOInt
	.line	14, "isr.c"; 	INT0IF = 0;
	MOVIA	0xfb
	BANKSEL	_INTF
	MOVAR	_INTF
_00106_DS_:
	.line	16, "isr.c"; 	if (PABIF)//(PABIE && PABIF)
	BANKSEL	_INTF
	BTRSS	_INTF,1
	MGOTO	_00108_DS_
	.line	18, "isr.c"; 	PABIF = 0;
	MOVIA	0xfd
	MOVAR	_INTF
_00108_DS_:
	.line	20, "isr.c"; 	if (Adc_GetIntFlag())
	BANKSEL	_ADR
	BTRSS	_ADR,7
	MGOTO	_00113_DS_
;;unsigned compare: left < lit (0x8=8), size=1
	.line	22, "isr.c"; 	Adc_EvComplated(Adc_GetResult());
	MOVIA	0x08
	BANKSEL	__Adc_mDiscard
	SUBAR	__Adc_mDiscard,W
	BTRSC	STATUS,0
	MGOTO	_00110_DS_
	INCR	__Adc_mDiscard,F
	BANKSEL	_ADMD
	BSR	_ADMD,6
	MGOTO	_00111_DS_
_00110_DS_:
	BCR	_PCONbits,0
_00111_DS_:
	.line	23, "isr.c"; 	Adc_ClrIntFlag();
	BANKSEL	_ADR
	BCR	_ADR,7
_00113_DS_:
	.line	25, "isr.c"; 	if(Tim0_GetIntFlag())
	BANKSEL	_INTF
	BTRSS	_INTF,0
	MGOTO	_00115_DS_
	.line	27, "isr.c"; 	Tim0_Reload();
	MOVIA	0x3d
	MOVAR	_TMR0
	.line	28, "isr.c"; 	Tim0_ClrIntFlag();
	MOVIA	0xfe
	MOVAR	_INTF
	.line	29, "isr.c"; 	Polsys_Tick();
	MOVIA	0x01
	BANKSEL	__Polsys_mTicked
	MOVAR	__Polsys_mTicked
_00115_DS_:
	.line	32, "isr.c"; 	if (Tim1_GetIntFlag())  // TIM1 用于电容充放电计时
	BANKSEL	_INTF
	BTRSS	_INTF,3
	MGOTO	_00117_DS_
	.line	35, "isr.c"; 	SoftCT_EvTimeout();
	MCALL	_SoftCT_EvTimeout
	.line	36, "isr.c"; 	Tim1_ClrIntFlag();
	MOVIA	0xf7
	BANKSEL	_INTF
	MOVAR	_INTF
_00117_DS_:
	.line	39, "isr.c"; 	if(Wdt_GetIntFlag())
	BANKSEL	_INTF
	BTRSS	_INTF,6
	MGOTO	_00120_DS_
	.line	41, "isr.c"; 	Wdt_ClrIntFlag();// Pow_Reset();
	MOVIA	0xbf
	MOVAR	_INTF
_00120_DS_:
	.line	43, "isr.c"; 	}
	BANKSEL	___sdcc_saved_stk01
	MOVR	___sdcc_saved_stk01,W
	MOVAR	STK01
	BANKSEL	___sdcc_saved_stk00
	MOVR	___sdcc_saved_stk00,W
	MOVAR	STK00
	BANKSEL	___sdcc_saved_fsr
	MOVR	___sdcc_saved_fsr,W
	MOVAR	FSR
	MOVR	PSAVE,W
	MOVAR	PCHBUF
	CLRR	STATUS
	SWAPR	SSAVE,W
	MOVAR	STATUS
	SWAPR	WSAVE,F
	SWAPR	WSAVE,W
END_OF_INTERRUPT:
	RETIE	

;--------------------------------------------------------
; code
;--------------------------------------------------------

;	code size estimation:
;	   64+   18 =    82 instructions (  200 byte)

	end
